package service

import (
	"leading/global"
	"leading/models"
)

// 判断目录是否存在
func IsDirExist(fileId string, userID uint) bool {
	var fileModel models.FileModel
	fileModel.FileId = fileId
	num := global.DB.Where("id = ? and user_id = ?", fileId, userID).First(&fileModel).RowsAffected
	if num > 0 {
		return true
	}
	return false
}

func IsFileExit(Id uint, userID uint) bool {
	var filemodel models.FileModel
	num := global.DB.Model(&filemodel).Where("id = ? and user_id = ?", Id, userID).First(&filemodel).RowsAffected
	if num > 0 {
		return true
	}
	return false
}
